package com.gq.common.utils;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import com.gq.business.commoncontroller.CommonReponse;
import com.gq.business.commoncontroller.CommonResponseBody;
import com.gq.common.response.ResponseBean;
import com.gq.config.RetunCode;

/**
 * 
 * http工具类 Detailed description
 * 
 * @author Administrator
 * @version [version, 2016年1月7日]
 * @see [relevant class/method]
 * @since [product/module version]
 */
public class HttpUtils
{
    public static <T> void responseJson(HttpServletResponse response, RetunCode returncode)
    {
        response.setContentType("text/json;charset=UTF-8");
        CommonReponse cr = new CommonReponse();
        cr.getHeader().setCode(returncode.getCode());
        cr.getHeader().setMsg(returncode.getMsg());
        String returnXML = JsonUtils.toJson(cr);
        
        try
        {
            response.getWriter().write(returnXML);
            response.flushBuffer();
        }
        catch (IOException e)
        {
        
        }
    }
}
